package ua.yandex.shad.tempseries;

/**
 * Catches temperatures lower then
 * {@link IllegalTemperatureValueException#minTemp}C.
 *
 * @author Vindex10
 */
public class IllegalTemperatureValueException extends Exception {
  /**
   * Variable needed for serialization.
   */
  private static final long serialVersionUID = 1L;
  /**
   * Minimal temperature value.
   */
  private final double minTemp;
  /**
   * Shows error on incompatible input data.
   *
   * @param temp minimal temperature
   */
  public IllegalTemperatureValueException(final double temp) {
    this.minTemp = temp;
  }

  /**
   * Get {@link IllegalTemperatureValueException#minTemp} value.
   *
   * @return value of {@link IllegalTemperatureValueException#minTemp};
   */
  public final double getMinTemp() {
    return this.minTemp;
  }

  /**
   * returns error text.
   *
   * @return error text;
   */
  public final String getErrorText() {
    return "InputDataError: Temperature"
            + " should be greater then " + minTemp + "C, by definition!";
  }
}
